<template>
  <div>
    <el-button type="danger" @click="deleteAllVisible = true" class="delete"  v-if="_SHOWBTN(showBetCode2)">删除</el-button>
    <el-dialog width="432px" title="删除提示" :visible.sync="deleteAllVisible">
      <i>
        <img src="@/assets/image/Shape.png" alt />
      </i>
      <div class="text">
        <p class="first">确定删除此部门/岗位？</p>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="sure">确 定</el-button>
        <el-button type="cancel" @click="deleteAllVisible = false">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 确认 -->
    <el-dialog width="432px" title="温馨提示" :visible.sync="deleteAllVisible1">
      <i>
        <img src="@/assets/image/Shape.png" alt />
      </i>
      <div class="text">
        <p class="first">删除部门/岗位前请清空部门人员。</p>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="sure1">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  props: ["title", "id", "click","showBetCode2"],
  data() {
    return {
      deleteAllVisible: false,
      deleteAllVisible1: false,
    };
  },
  methods: {
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
    sure() {
      this.deleteAllVisible1 = true;
      this.deleteAllVisible = false;
    },
    sure1() {
      this.Api.deleteTissue1({ id: this.id }).then((res) => {
        if (res.code == 0) {
          this.$message.success('删除成功')
          this.click();
          this.deleteAllVisible1 = false;
        }else{
           this.$message.error(res.message)
         
        }
      });
       this.deleteAllVisible1 = false;
    },
  },
};
</script>
<style lang="less" scoped>
/deep/.el-button--deleteAll {
  width: 80px;
  height: 36px;
  background: rgba(255, 255, 255, 1);
  border-radius: 3px;
  border: 1px solid rgba(251, 54, 63, 1);
  padding: 0;
  color: #fb363f;
}
/deep/.el-dialog {
  margin-top: 19% !important;
  box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  > .el-dialog__header {
    padding-right: 255px;
    padding-bottom: 0;
    background: none;
    > span {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: rgba(0, 0, 0, 0.85);
      line-height: 24px;
    }
  }
  > .el-dialog__body {
    padding-left: 70px;
    padding-top: 12px;
    padding-bottom: 24px;
    position: relative;
    > i {
      position: absolute;
      left: 32px;
      top: -22px;
    }
    > span {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
    }
  }
  > .el-dialog__footer {
    .el-button--primary {
      width: 65px;
      height: 32px;
      background: rgba(22, 119, 255, 1);
      padding: 0;
      color: white;
    }
    .el-button--cancel {
      width: 65px;
      height: 32px;
      background: rgba(250, 250, 250, 1);
      border: 1px solid rgba(221, 221, 221, 1);
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(102, 102, 102, 1);
      padding: 0;
      margin-left: 8px;
    }
  }
}
.edit {
  display: block;
  color: #1677ff;
  font-size: 14px;
  border-left: none;
  width: 48px;
  height: 14px;
  text-align: center;
  line-height: 14px;
  border-left: 1px solid #dddddd;
}
/deep/.el-icon-close:before {
  content: "";
}
.text {
  text-align: left;
}
.first {
  font-size: 14px;
  color: #666666;
}
.second {
  font-size: 12px;
  color: #999999;
}
.delete {
  width: 60px;
  height: 28px;
  padding: 0;
}
</style>